cmake_minimum_required(VERSION 3.20)
project(quickjspp LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)

if(CMAKE_COMPILER_IS_GNUCC)
    add_compile_options(-Wall -Wno-unused-parameter)
endif()

#add_subdirectory(../msvc quickjs EXCLUDE_FROM_ALL)

add_library(quickjspp INTERFACE)
target_link_libraries(quickjspp INTERFACE libquickjs ${CMAKE_REQUIRED_LIBRARIES})
target_compile_features(quickjspp INTERFACE cxx_std_17)
target_include_directories(quickjspp INTERFACE .)
set_target_properties(quickjspp PROPERTIES PUBLIC_HEADER quickjspp.hpp)

add_executable(qjspp qjs.cpp)
target_link_libraries(qjspp quickjspp)

# cmake -DBUILD_TESTING=OFF to disable tests
#include(CTest)
if(BUILD_TESTING)
    add_subdirectory(test)
endif()

install(TARGETS quickjspp qjs)
